<?php

namespace app\services\office;

use app\dao\office\OfficeStudyRecordDao;
use app\exceptions\AuthException;
use app\services\BaseService;

class OfficeStudyRecordService extends BaseService
{

    public function __construct(OfficeStudyRecordDao  $dao)
    {
        $this -> dao = $dao;
    }

    public function index(array $where)
    {
        return $this -> dao -> index($where);
    }

    public function update(array $where)
    {
        return $this ->dao ->updateDao($where);
    }

    public function delete(array $where)
    {
        return $this ->dao -> deleteDao($where);
    }

    public function create(array $where)
    {
        return $this -> dao -> createDao($where);
    }

    //------------------------------------api----------------------------------------------------------------------

    /*
     * 保存学习记录
     */

    public function insertVideo(array $where){
        $result = $this->dao->insertVideo($where);
        if ($result){
            return '成功';
        }else{
            throw new AuthException('保存失败');
        }
    }

    /*
     * 查询学习记录
     */
    public function selectVideo(array $where){
        return $this->dao->selectvideo($where);

    }
}